home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / ADA / GNAT / !gcc / adainc / 6 / ads / s-tasclo < prev    next >
Text File  |  1996-02-12  |  5KB  |  109 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --                     S Y S T E M . T A S K _ C L O C K                    --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                           (Compiler Interface)                           --
  9. --                                                                          --
  10. --                             $Revision: 1.12 $                             --
  11. --                                                                          --
  12. --    Copyright (C) 1991, 92, 93, 94, 1995 Free Software Foundation, Inc.   --
  13. --                                                                          --
  14. -- GNARL is free software; you can  redistribute it  and/or modify it under --
  15. -- terms of the  GNU General Public License as published  by the Free Soft- --
  16. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  17. -- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
  18. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  19. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  20. -- for  more details.  You should have  received  a copy of the GNU General --
  21. -- Public License  distributed with GNARL; see file COPYING.  If not, write --
  22. -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
  23. -- MA 02111-1307, USA.                                                      --
  24. --                                                                          --
  25. -- As a special exception,  if other files  instantiate  generics from this --
  26. -- unit, or you link  this unit with other files  to produce an executable, --
  27. -- this  unit  does not  by itself cause  the resulting  executable  to  be --
  28. -- covered  by the  GNU  General  Public  License.  This exception does not --
  29. -- however invalidate  any other reasons why  the executable file  might be --
  30. -- covered by the  GNU Public License.                                      --
  31. --                                                                          --
  32. -- GNARL was developed by the GNARL team at Florida State University. It is --
  33. -- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
  34. -- State University (http://www.gnat.com).                                  --
  35. --                                                                          --
  36. ------------------------------------------------------------------------------
  37.  
  38. --  This package interfaces with the Ada RTS and defines the low-level
  39. --  timer operations.
  40.  
  41. --  Note: this package is not a direct part of the compiler interface, but
  42. --  it is used by the System.Task_Timer spec, which is part of the interface.
  43.  
  44. with Interfaces;
  45.  
  46. package System.Task_Clock is
  47.  
  48.    type Stimespec is private;
  49.  
  50.    Stimespec_First : constant Stimespec;
  51.  
  52.    Stimespec_Last  : constant Stimespec;
  53.  
  54.    Stimespec_Zero  : constant Stimespec;
  55.  
  56.    Stimespec_Unit  : constant Stimespec;
  57.  
  58.    Stimespec_Sec_Unit : constant Stimespec;
  59.  
  60.    function Stimespec_Seconds (TV : Stimespec) return Integer;
  61.  
  62.    function Stimespec_NSeconds (TV : Stimespec) return Integer;
  63.  
  64.    function Time_Of (S, NS : Integer) return Stimespec;
  65.  
  66.    function Stimespec_To_Duration (TV : Stimespec) return Duration;
  67.  
  68.    function Duration_To_Stimespec (Time : Duration) return Stimespec;
  69.  
  70.    function "-"  (TV : Stimespec) return Stimespec;
  71.  
  72.    function "+"  (LTV, RTV : Stimespec) return Stimespec;
  73.  
  74.    function "-"  (LTV, RTV : Stimespec) return Stimespec;
  75.  
  76.    function "*"  (TV : Stimespec; N : Integer) return Stimespec;
  77.  
  78.    function "/"  (TV : Stimespec; N : integer) return Stimespec;
  79.  
  80.    function "/"  (LTV, RTV : Stimespec) return Integer;
  81.  
  82.    function "<"  (LTV, RTV : Stimespec) return Boolean;
  83.  
  84.    function "<=" (LTV, RTV : Stimespec) return Boolean;
  85.  
  86.    function ">"  (LTV, RTV : Stimespec) return Boolean;
  87.  
  88.    function ">=" (LTV, RTV : Stimespec) return Boolean;
  89.  
  90. private
  91.  
  92.    --  Stimespec is represented in 64-bit Integer. It represents time in
  93.    --  nanoseconds. For example, 1 second and 1 nanosecond is represented
  94.    --  as "1_000_000_001"
  95.  
  96.    type Stimespec is new Interfaces.Integer_64;
  97.  
  98.    Stimespec_First    : constant Stimespec := Stimespec'First;
  99.  
  100.    Stimespec_Last     : constant Stimespec := Stimespec'Last;
  101.  
  102.    Stimespec_Zero     : constant Stimespec := 0;
  103.  
  104.    Stimespec_Unit     : constant Stimespec := 1;
  105.  
  106.    Stimespec_Sec_Unit : constant Stimespec := 10#1#E9;
  107.  
  108. end System.Task_Clock;
  109.